ctxt->cpu_ctxt.ss = FLAT_GUESTOS_DS;
ctxt->cpu_ctxt.cs = FLAT_GUESTOS_CS;
ctxt->cpu_ctxt.eip = vkern_entry;
- ctxt->cpu_ctxt.esp = vstartinfo_start;
+ ctxt->cpu_ctxt.esp = vstartinfo_start + 2*PAGE_SIZE;
ctxt->cpu_ctxt.esi = vstartinfo_start;
ctxt->cpu_ctxt.eflags = (1<<9) | (1<<2);
/* Ring 1 stack is the initial stack. */
ctxt->guestos_ss = FLAT_GUESTOS_DS;
- ctxt->guestos_esp = vstartinfo_start;
+ ctxt->guestos_esp = vstartinfo_start + 2*PAGE_SIZE;
/* No debugging. */
memset(ctxt->debugreg, 0, sizeof(ctxt->debugreg));
return -EPERM;
if ( copy_from_user(op, u_dom0_op, sizeof(*op)) )
- {
return -EFAULT;
- }
if ( op->interface_version != DOM0_INTERFACE_VERSION )
- {
return -EACCES;
- }
TRACE_5D(TRC_DOM0OP_ENTER_BASE + op->cmd,
0, op->u.dummy[0], op->u.dummy[1],
case DOM0_CREATEDOMAIN:
{
- struct domain *d;
- unsigned int pro;
- domid_t dom;
+ struct domain *d;
+ unsigned int pro = 0;
+ domid_t dom;
dom = op->u.createdomain.domain;
if ( (dom > 0) && (dom < DOMID_FIRST_RESERVED) )
break;
if ( op->u.createdomain.cpu == -1 )
- {
- /* Do an initial placement. Fix me for hyperthreading! */
- struct domain *d;
- int i, j=0, c[smp_num_cpus];
-
- pro=0; /* keep compiler happy */
-
- for (i=0;i<smp_num_cpus;i++)
- c[i]=0;
-
- for_each_domain ( d ) {
- c[d->processor]++;
- j++;
- }
-
- for (i=0;i<smp_num_cpus;i++) {
- if( c[i]<j )
- {
- j = c[i];
- pro = i;
- }
- }
- }
+ {
+ /* Do an initial placement. Pick the least-populated CPU. */
+ struct domain *d;
+ unsigned int i, cnt[NR_CPUS] = { 0 };
+
+ read_lock_irq(&tasklist_lock);
+ for_each_domain ( d )
+ cnt[d->processor]++;
+ read_unlock_irq(&tasklist_lock);
+
+ for ( i = 0; i < smp_num_cpus; i++ )
+ if ( cnt[i] < cnt[pro] )
+ pro = i;
+ }
else
pro = op->u.createdomain.cpu % smp_num_cpus;
break;
}
- if ( page->u.inuse.type_info & PGT_pinned )
- type |= LPINTAB;
- l_arr[j] |= type;
+ if ( page->u.inuse.type_info & PGT_pinned )
+ type |= LPINTAB;
+ l_arr[j] |= type;
put_page(page);
}
else
d = find_domain_by_id( op->u.setdomainmaxmem.domain );
if ( d != NULL )
{
- vm_assist(d, op->u.setdomainvmassist.cmd,
+ vm_assist(d, op->u.setdomainvmassist.cmd,
op->u.setdomainvmassist.type);
put_domain(d);
ret = 0;
if ( reason == 0 )
{
- printk("Domain 0 halted: Our work here is done.\n");
+ printk("Domain 0 halted: halting machine.\n");
machine_halt();
}
else
{
- printk("Domain 0 shutdown: rebooting machine!\n");
+ printk("Domain 0 shutdown: rebooting machine.\n");
machine_restart(0);
}
}
/* initialise to machine_to_phys_mapping table to likely pfn */
machine_to_phys_mapping[page-frame_table] = alloc_pfns;
-
-#ifndef NDEBUG
- {
- /* Initialise with magic marker if in DEBUG mode. */
- void *a = map_domain_mem((page-frame_table)<<PAGE_SHIFT);
- memset(a, 0x80 | (char)d->id, PAGE_SIZE);
- unmap_domain_mem(a);
- }
-#endif
}
return 0;